import {showToast} from "vant";
export const useFollow=()=>{
    //有关店铺关注按钮的状态显示
    const followLoading=ref(false)
    const isFollowed=ref(false)
    const followText = computed(()=>{
        return isFollowed.value? '已关注':'关注'
    })
    const followBtnClick = (e:any)=>{
        if(followLoading.value)	return
        followLoading.value=true
        setTimeout(()=>{
            //导步请求后的实现
            let tmp =!isFollowed.value
            showToast({ message: tmp? '感谢关注本店':'已取消关注', type: 'success',duration:1500, })
            followLoading.value=false
            isFollowed.value=tmp
            e.target.blur()
        },1000)

    }
    return {
        followLoading, isFollowed,followText,followBtnClick,
    }
}